﻿using System;
using System.Data;
using System.Linq;
using System.Web;
using System.Collections;
using System.Web.Services;
using System.Web.Services.Protocols;
using System.ComponentModel;
using System.Web.UI;
using BluePortal.Medias.Core;

namespace BluePortal.QuikStart.WSAjax
{
    [WebService(Namespace = "BluePortal.QuikStart.WSAjax")]
    [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
    [ToolboxItem(false)]
    [System.Web.Script.Services.ScriptService]
    public class WSLists : System.Web.Services.WebService
    {
        [WebMethod]
        public void AddVideoToPlayList(string playlistName, string vid)
        {
            BCPlaylist playlistBC = new BCPlaylist();
            Playlist pl = playlistBC.FindByNames(playlistName, HttpContext.Current.User.Identity.Name);

            if (pl == null)
            {
                pl = new Playlist();
                pl.PlayListName = playlistName;
                pl.LoginName = HttpContext.Current.User.Identity.Name;
            }
            playlistBC.Add(pl, new Guid(vid));
        }

        [WebMethod]
        public void AddVideoToFavorite(string vid)
        {
            //@todo 
            //VideoFavoriteAdapter.instance.Create(new BluePortal.Core.BusinessObjects.Favorite() { LoginName = HttpContext.Current.User.Identity.Name, VID = new Guid(vid) });
        }
        
        [WebMethod]
        public void AddMember(string chid)
        {
            new BCChannelUser().AddUser(new Guid(chid), HttpContext.Current.User.Identity.Name);
        }
        
    }
}
